import Cookies from 'js-cookie'

const TokenKey = 'admin_token'
const UserTokenKey = 'user_token'

// 管理员token
export function getAdminToken() {
  return Cookies.get(TokenKey)
}

export function setAdminToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeAdminToken() {
  localStorage.removeItem('admin_token')
  localStorage.removeItem('admin')
  localStorage.removeItem('adminId')
  return Cookies.remove(TokenKey)
}

// 用户token
export function getUserToken() {
  return Cookies.get(UserTokenKey)
}

export function setUserToken(token) {
  return Cookies.set(UserTokenKey, token)
}

export function removeUserToken() {
  localStorage.removeItem('user_token')
  localStorage.removeItem('user')
  localStorage.removeItem('userId')
  return Cookies.remove(UserTokenKey)
}
